<?
include("../lib/config.php");
$nik 	= $HTTP_GET_VARS['nik'];
$op		= $HTTP_GET_VARS['op'];
$no		= $HTTP_GET_VARS['no'];
$tahun	= $HTTP_GET_VARS['tahun'];
$nama	= $HTTP_GET_VARS['nama'];
$show 	= $HTTP_GET_VARS['show'];
$appr	= $HTTP_GET_VARS['appr'];
$kode_cuti = $HTTP_GET_VARS['kode_cuti'];
include("../header.php");
?>
<script type="text/javascript">
	
	MaskInput = function(f, m){
	function mask(e){
		var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[\xC0-\xFF]/i, "8": /./ },
			rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
		function accept(c, rule){
			for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
				if(r & i && patterns[i].test(c))
					break;
				return i <= r || c == rule;
		}
		var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
		(!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
			r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
			: (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
			r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
	}
	for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
		addEvent(f, i, mask);
};

	function ValidateCKhusus(){

		if(document.forms['FCK'].nik.value == ""){
			alert("Maaf, NIK tidak boleh kosong ...");
			document.forms['FCK'].nik.focus();
			return false;
		}

		if(document.forms['FCK'].jenis_cuti.value == ""){
			alert("Maaf, Jenis Cuti harus dipilih ...");
			document.forms['FCK'].jenis_cuti.focus();
			return false;
		}
		
		if(document.forms['FCK'].tgl_mulai.value == ""){
			alert("Maaf, Tanggal Mulai harus diisi ...");
			document.forms['FCK'].tgl_mulai.focus();
			return false;
		}
		
		if(document.forms['FCK'].tgl_selesai.value == ""){
			alert("Maaf, Tanggal Selesai harus diisi ...");
			document.forms['FCK'].tgl_selesai.focus();
			return false;
		}
		
		if(document.forms['FCK'].jumlah_cuti.value == ""){
			alert("Maaf, Jumlah Cuti harus diisi ...");
			document.forms['FCK'].jumlah_cuti.focus();
			return false;
		}
				
		document.forms['FCK'].submit();
	}
	
	function show_popup(page)
	{
		child = open
		(
			"frm_list_emp.php",
			"",
			"scrollbars,width=400,height=400,left=150,top=150"
		);
	}

		function ValTahunan()
		{
			if(document.forms[0].nik.value==""){
				alert("NIK Harus diisi");
				document.forms['CK'].nik.focus()
				return false;
			}		
			
			if(document.forms[0].periode1.value==""){
				alert("Periode Tahun Harus diisi");
				document.forms[0].periode1.focus()			
				return false;
			}

			// tgl_cuti == tgl_mulai
			<?
			for($j=1;$j<=1;$j++){
			?>
			if(document.forms[0].tgl_mulai<?=$j?>.value==""){
				alert("Tanggal Cuti Harus diisi");
				document.forms[0].tgl_mulai<?=$j?>.focus()			
				return false;
			}
			<?
			}
			?>
			/*
			if(document.forms[0].tunda.value==""){
				alert("Tunda harus dipilih");
				document.forms[0].tunda.focus()			
				return false;
			}
			if(document.forms[0].ambil.value==""){
				alert("Ambil harus dipilih");
				document.forms[0].ambil.focus()			
				return false;
			}
			*/
			document.forms[0].submit();
			
		}

		function ValBesar()
		{
			if(document.forms['CB'].nik.value==""){
				alert("NIK Harus diisi");
				document.forms['CB'].nik.focus()
				return false;
			}		
			
			// tgl_cuti == tgl_mulai
			if(document.forms['CB'].tgl_mulai.value==""){
				alert("Tanggal Cuti Harus diisi");
				document.forms['CB'].tgl_mulai.focus()			
				return false;
			}
			// tgl_selesai
			if(document.forms['CB'].tgl_selesai.value==""){
				alert("Tanggal Selesai Harus diisi");
				document.forms['CB'].tgl_selesai.focus()			
				return false;
			}
			if(document.forms['CB'].jumlah_cuti.value==""){
				alert("Jumlah Cuti Harus diisi");
				document.forms['CB'].jumlah_cuti.focus()			
				return false;
			}
			if(document.forms['CB'].keterangan.value==""){
				alert("Keterangan Harus diisi");
				document.forms['CB'].keterangan.focus()			
				return false;
			}
			/*
			if(document.forms['CB'].tunda.value==""){
				alert("Tunda harus dipilih");
				document.forms['CB'].tunda.focus()			
				return false;
			}
			if(document.forms['CB'].ambil.value==""){
				alert("Ambil harus dipilih");
				document.forms['CB'].ambil.focus()			
				return false;
			}*/
			
			document.forms['CB'].submit();
			
		}
	
</script>
</head>
<table width="93%" class="table_indent2">
 <tr>
  <td class="line_bottom">&nbsp;&nbsp;<b>CUTI KARYAWAN</b></td>
 </tr>
</table>

<table width="100%">
<?
	if($show == "cuti_khusus")
	{
		if($op == "edit"){
			$Faction = "../lib/update.php";
			$Vbutton = "Update";
			$query	= mssql_query("SELECT * FROM VCuti WHERE id='$no'",$conn);
			$row	= mssql_fetch_array($query);
		}
		elseif($op == ""){
			$Faction = "../lib/save.php";
			$Vbutton = "Simpan";
		}
		// approval cuti
		/*
		if($appr == "yes"){
			$Faction = "../lib/update.php";
			$Vbutton = "Setujui";
			$query	= mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, * FROM VCuti WHERE NIK='$nik' ) SELECT * FROM limit WHERE No='$no'",$conn);
			$row	= mssql_fetch_array($query);
		}
	*/
?>
<form name='FCK' method='post' action="<?=$Faction?>" >
 <tr>
  <td colspan="2">
   <table>
    <tr>
	 <td width="110">NIK</td>
	 <td><input type="text" name="nik" value="<?=$nik?>" readonly=""/>
	<?
		if($HTTP_GET_VARS['nik'] == NULL ){
			echo"<a href='Javascript:show_popup()'><img src='../images/people.png' border=0></a>";
		}
	?>
	 </td>
	</tr>
    <tr>
	 <td>Nama</td>
	 <td><input type="text" name="nama" size="45" value="<?
     if(empty($row[Nama])){
	 	// get nama
		$snama = mssql_query("SELECT Nama FROM Karyawan WHERE NIK='$nik'",$conn);
		$rnama = mssql_fetch_array($snama);
		echo $rnama[0];
	 }
	 else{
	 	echo $row[Nama];
	 }
	 ?>" 
     readonly="" /></td>
	</tr>	
   </table>
  </td>
 </tr>
 <tr>
  <td colspan="2"><hr noshade="noshade" size="-2"/></td>
 </tr>
 <tr>
  <td valign="top" colspan="2">
  <fieldset><legend><b>Cuti Khusus</b></legend>
  <table width="100%">
 <tr>
  <td width="100%">
   <table width="100%">
	<tr>
	 <td width="100">Jenis Cuti:</td>
	 <td>
	  <select name="jenis_cuti">
	  <?
	  	// GET CUTI SELECTED
	  	//$getCuti = mssql_query("SELECT * FROM VJCuti WHERE kode_cuti='".$row[kode_cuti]."' ",$conn);
		//$rowCuti = mssql_fetch_array($getCuti);
		//echo"<option value='$rowCuti[kode_cuti]'>$rowCuti[nama]</option>";
		
	  ?>
	   <option value="">--pilih--</option>
	   <?
	   	$scuti 		 = mssql_query("SELECT * FROM VJCuti WHERE NAMA NOT IN ('Cuti Besar') ORDER BY nama ",$conn);
		while($rcuti = mssql_fetch_array($scuti)){
			echo"<option value='$rcuti[kode_cuti]'";
			if($row[kode_cuti] == $rcuti[kode_cuti]){
				echo" selected";
			}
			echo">$rcuti[nama]</option>";
		}
	   ?>
	  </select> <span class="required">*</span>
	 </td>
	</tr>
	<tr>
	 <td>Tanggal Mulai:</td>
	 <td><input type="text" maxlength="10" size="11" name="tgl_mulai" value="<?=$row[TglAwal]?>" /> <span class="required">*</span>  <a href="javascript:calA.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a> </td>
	</tr>
	<tr>
	 <td>Tanggal Selesai:</td>
	 <td><input type="text" maxlength="10" size="11" name="tgl_selesai" value="<?=$row[TglAkhir]?>" /> <span class="required">*</span>  <a href="javascript:calB.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a> </td>
	</tr>
	<tr>
	 <td valign="top">Jumlah Cuti:</td>
	 <td valign="top">
	  <input type="text" maxlength="3" size="4" name="jumlah_cuti" value="<?=$row[jml_cuti]?>" /> <span class="required">* harus angka</span>
	 </td>
	</tr>
	<tr>
	 <td valign="top">Keterangan:</td>
	 <td valign="top">
	  <textarea name="keterangan" cols="45" rows="5"><?=$row[keterangan]?></textarea>
	 </td>
	</tr>
   </table>
  </td>
 </tr>
 </table>
 </fieldset>
 </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="right">
  <input type="hidden" name="cat" value="cuti_khusus" />
  <input type="hidden" name="no" value="<?=$row[id]?>" />
  <input type="button" value="Batal" class="button" onclick="Javascript:history.back();" />
  <input type="button" value="<?=$Vbutton?>" class="button" onclick="Javascript:ValidateCKhusus();" />
  </form>
  </td>
 </tr>
</table>
</form>
</td>
</tr>
	<?
		}
		elseif($show == "cuti_tahunan"){
		
		if($op == "edit"){
			$Faction = "../lib/update.php";
			$Vbutton = "Update";
			$query	= mssql_query("WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY periode) AS No, CONVERT(CHAR(12), tgl_cuti, 103) TglCuti, CONVERT(CHAR(12), tgl_hangus, 103) TglHangus, CONVERT(CHAR(12), tgl_selesai, 103) TglSelesai,  * FROM CutiTahunan WHERE NIK='$nik') SELECT * FROM limit WHERE No='$no'",$conn);
			$row	= mssql_fetch_array($query);
		}
		else{//if($op == ""){
			$Faction = "../lib/save.php";
			$Vbutton = "Simpan";
		}

	?>
<form name="CT" method="post" action="<?=$Faction?>">
 <tr>
  <td colspan="2">
   <table>
    <tr>
	 <td width="110">NIK</td>
	 <td><input type="text" name="nik" value="<?=$nik?>" readonly=""/>
	<?
		if($HTTP_GET_VARS['nik'] == NULL ){
			echo"<a href='Javascript:show_popup()'><img src='../images/people.png' border=0></a>";
		}
	?>
	 </td>
	</tr>
    <tr>
	 <td>Nama</td>
	 <td><input type="text" name="nama" size="45" value="<?
     if(empty($row[Nama])){
	 	// get nama
		$snama = mssql_query("SELECT Nama FROM Karyawan WHERE NIK='$nik'",$conn);
		$rnama = mssql_fetch_array($snama);
		echo $rnama[0];
	 }
	 else{
	 	echo $row[Nama];
	 }
	?>" readonly="" /></td>
	</tr>	
   </table>
  </td>
 </tr>
 <tr>
  <td colspan="2"><hr noshade="noshade" size="-2"/></td>
 </tr>
 <tr>
  <td valign="top" colspan="2">
   <fieldset><legend><b>CUTI TAHUNAN</b></legend>
    <table width="100%" border="0">
     <tr>
      <td colspan="2">
       <table border="0" width="90%">
        <tr>
        <?
        // pecah
		if($row[periode] == "-" || $row[periode] == NULL){
		// do nothing
		}
		else{
		// 2000 - 2000
		// 01234567890
			$periode1 = substr($row[periode],0,4);
			$periode2 = substr($row[periode],7,4);
		}

			// tahun periode
			$now_year	= date("Y");
			$now_year1	= $now_year + 1;
           ?>

		<?
        	// untuk menampilkan periode tahun cuti
			if(empty($HTTP_GET_VARS[periode])){
				$periode_t = $now_year." - ".$now_year1;
			}
			else{
				$periode_t = $HTTP_GET_VARS[periode];
			}
		?>
         <td colspan="7">Periode Tahun: <input type="text" value="<?=$periode_t?>" name="periode1" /> <span class="required">*</span>
         </td>
        </tr>
        <tr>
         <td colspan="6"><hr noshade="noshade" size="-2" /></td>
        </tr>
        <tr class="headlist">
         <td>&nbsp;</td>
         <td>Tanggal Cuti</td>
         <td valign="top">Keterangan:</td>
         <td valign="top">Tunda:</td>
         <?
         	if($op == "edit"){
		 ?>
         <td valign="top">Ambil:</td>
         <?
         	}
		 ?>
        </tr>
        <?
            $gj = mssql_query("SELECT jatah_cuti, syarat_waktu FROM VJCuti WHERE nama='Cuti Tahunan'",$conn);
            $rj = mssql_fetch_array($gj);
            $jatah_cuti = $rj[jatah_cuti];
        	for($i=1;$i<=$jatah_cuti;$i++){
		?>
        <tr>
         <td>Hari Ke-<?=$i?></td>
         <td><input type="text" value="<?=$row[TglCuti]?>" maxlength="10" size="11" name="tgl_mulai<?=$i?>" /> <span class="required">*</span>  <a href="javascript:cal<?=$i?>.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a>
         </td>   
         <td>
         <input type="text" maxlength="45" size="35" name="keterangan<?=$i?>" value="<?=$row[keterangan]?>" />
         </td>
         <td>
          <select name="tunda<?=$i?>">
           <option value="0" <? if($op == NULL){ } elseif($op == "edit"){ if($row[tunda] == 0){ echo"selected"; } }?>>Tidak</option>
           <option value="1" <? if($op == NULL){ } elseif($op == "edit"){ if($row[tunda] == 1){ echo"selected"; } }?>>Ya</option>
          </select>           
         </td> 
         <?
         	if($op == "edit"){
		 ?> 
         <td>
          <select name="ambil<?=$i?>">
           <option value="0" <? if($op == NULL){ } elseif($op == "edit"){ if($row[ambil] == 0){ echo"selected"; }}?>>Tidak</option>
           <option value="1" <? if($op == NULL){ } elseif($op == "edit"){ if($row[ambil] == 1){ echo"selected"; }}?>>Ya</option> 
          </select> 
         </td>
         <?
         }
		 ?>
        </tr>
        <?
        }
		?>
     </table>
     </fieldset>
     </td>
	</tr>
   </table>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="center">
  <input type="hidden" name="cat" value="cuti_tahunan" />
  <input type="hidden" name="no" value="<?=$row[No]?>" />
  <input type="button" value="Batal" class="button" onclick="Javascript:history.back();" />
  <input type="button" value="<?=$Vbutton?>" class="button" onclick="Javascript:ValTahunan();" />
  </td>
 </tr>
</table>
</td>
</tr>
</form>

	<?	
		}
		elseif($show == "cuti_tahunan_ed"){
		
		if($op == "edit"){
			$Faction = "../lib/update.php";
			$Vbutton = "Update";
			$query	= mssql_query("WITH limit AS (SELECT CONVERT(CHAR(12), tgl_cuti, 103) TglCuti, CONVERT(CHAR(12), tgl_hangus, 103) TglHangus, CONVERT(CHAR(12), tgl_selesai, 103) TglSelesai, * FROM CutiTahunan WHERE NIK='$nik' AND id='$no') SELECT * FROM limit WHERE id='$no'",$conn);
			$row	= mssql_fetch_array($query);
		}
		elseif($op == ""){
			$Faction = "../lib/save.php";
			$Vbutton = "Simpan";
		}

	?>
<form name="CT" method="post" action="<?=$Faction?>">
 <tr>
  <td colspan="2">
   <table>
    <tr>
	 <td width="110">NIK</td>
	 <td><input type="text" name="nik" value="<?=$nik?>" readonly=""/>
	<?
		if($HTTP_GET_VARS['nik'] == NULL ){
			echo"<a href='Javascript:show_popup()'><img src='../images/people.png' border=0></a>";
		}
	?>
	 </td>
	</tr>
    <tr>
	 <td>Nama</td>
	 <td><input type="text" name="nama" size="45" value="<?
     if(empty($row[Nama])){
	 	// get nama
		$snama = mssql_query("SELECT Nama FROM Karyawan WHERE NIK='$nik'",$conn);
		$rnama = mssql_fetch_array($snama);
		echo $rnama[0];
	 }
	 else{
	 	echo $row[Nama];
	 }
	?>" readonly="" /></td>
	</tr>	
   </table>
  </td>
 </tr>
 <tr>
  <td colspan="2"><hr noshade="noshade" size="-2"/></td>
 </tr>
 <tr>
  <td valign="top" colspan="2">
   <fieldset><legend><b>CUTI TAHUNAN</b></legend>
    <table width="100%" border="0">
     <tr>
      <td colspan="2">
       <table border="0" width="90%">
        <tr>
        <?
        // pecah
		if($row[periode] == "-" || $row[periode] == NULL){
		// do nothing
		}
		else{
		// 2000 - 2000
		// 01234567890
			$periode1 = substr($row[periode],0,4);
			$periode2 = substr($row[periode],7,4);
		}

			// tahun periode
			$now_year	= date("Y");
			$now_year1	= $now_year + 1;
           ?>

<!--         <td colspan="7">Periode Tahun: <input type="text" value="<?=$now_year?> - <?=$now_year1?>" readonly="readonly" name="periode1" /> <span class="required">*</span>-->
         
                  <td colspan="7">Periode Tahun: <input type="text" value="<?=$row[periode]?>" readonly="readonly" name="periode1" /> <span class="required">*</span>

         </td>
        </tr>
        <tr>
         <td colspan="6"><hr noshade="noshade" size="-2" /></td>
        </tr>
        <tr class="headlist">
         <td>&nbsp;</td>
         <td>Tanggal Cuti</td>
         <td valign="top">Keterangan:</td>
         <td valign="top">Tunda:</td>
         <td valign="top">Ambil:</td>
        </tr>
        <?
           // $gj = mssql_query("SELECT jatah_cuti, syarat_waktu FROM VJCuti WHERE nama='Cuti Tahunan'",$conn);
            //$rj = mssql_fetch_array($gj);
            //$jatah_cuti = $rj[jatah_cuti];
        	//for($i=1;$i<=1;$i++){
		?>
        <tr>
         <td>&nbsp;</td>
         <td><input type="text" value="<?=$row[TglCuti]?>" maxlength="10" size="11" name="tgl_mulai" /> <span class="required">*</span>  <a href="javascript:cal.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a>
         </td>   
         <td>
         <input type="text" maxlength="45" size="35" name="keterangan" value="<?=$row[keterangan]?>" />
         </td>
         <td>
          <select name="tunda">
           <option value="0" <? if($op == NULL){ } elseif($op == "edit"){ if($row[tunda] == 0){ echo"selected"; } }?>>Tidak</option>
           <option value="1" <? if($op == NULL){ } elseif($op == "edit"){ if($row[tunda] == 1){ echo"selected"; } }?>>Ya</option>
          </select>           
         </td>  
         <td>
          <select name="ambil">
           <option value="0" <? if($op == NULL){ } elseif($op == "edit"){ if($row[ambil] == 0){ echo"selected"; }}?>>Tidak</option>
           <option value="1" <? if($op == NULL){ } elseif($op == "edit"){ if($row[ambil] == 1){ echo"selected"; }}?>>Ya</option> 
          </select> 
         </td>
        </tr>
        <?
        //}
		?>
     </table>
     </fieldset>
     </td>
	</tr>
   </table>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="center">
  <input type="hidden" name="cat" value="cuti_tahunan_ed" />
  <input type="hidden" name="no" value="<?=$row[id]?>" />
  <input type="button" value="Batal" class="button" onclick="Javascript:history.back();" />
  <input type="submit" value="<?=$Vbutton?>" class="button" />
  </td>
 </tr>
</table>
</td>
</tr>
</form>

	<?	
		}		
		
		// CUTI BESAR
		elseif($show == "cuti_besar"){
		
		// periode cuti besar
		$per_cb = $HTTP_GET_VARS['per_cb'];
		
		if($op == "edit"){
			$Faction = "../lib/update.php";
			$Vbutton = "Update";
			$query	= mssql_query("SELECT *, CONVERT(CHAR(12), tgl_awal, 103) TglMulai, CONVERT(CHAR(12), tgl_akhir, 103) TglSelesai,  * FROM Cuti WHERE NIK='$nik' AND id='$no'",$conn);
			$row	= mssql_fetch_array($query);
		}
		elseif($op == ""){
			$Faction = "../lib/save.php";
			$Vbutton = "Simpan";
		}
?>
<form name="CB" method="post" action="<?=$Faction?>">
 <tr>
  <td colspan="2">
   <table>
    <tr>
	 <td width="110">NIK</td>
	 <td><input type="text" name="nik" value="<?=$nik?>" readonly=""/>
	<?
		if($HTTP_GET_VARS['nik'] == NULL ){
			echo"<a href='Javascript:show_popup()'><img src='../images/people.png' border=0></a>";
		}
	?>
	 </td>
	</tr>
    <tr>
	 <td>Nama</td>
	 <td><input type="text" name="nama" size="45" value="<?
     if(empty($row[Nama])){
	 	// get nama
		$snama = mssql_query("SELECT Nama FROM Karyawan WHERE NIK='$nik'",$conn);
		$rnama = mssql_fetch_array($snama);
		echo $rnama[0];
	 }
	 else{
	 	echo $row[Nama];
	 }
	 ?>" readonly="" /></td>
	</tr>	
   </table>
  </td>
 </tr>
 <tr>
  <td colspan="2"><hr noshade="noshade" size="-2"/></td>
 </tr>
 <tr>
  <td valign="top" colspan="2">
   <fieldset><legend><b>CUTI BESAR</b></legend>
    <table width="100%">
     <tr>
      <td colspan="2">
       <table border="0" width="60%">
         <tr>
          <td>Periode</td>
          <td><input type="text" readonly="readonly" value="<?
          if(empty($HTTP_GET_VARS['periode'])){
		  	echo"$row[periode]";
		  }
		  else{
		  	echo $HTTP_GET_VARS['periode'];
		  }
		  ?>" name="periode" /></td>
         </tr>
	     <tr>
         <td>Tanggal Cuti</td>
         <td><input type="text" value="<?=$row[TglMulai]?>" maxlength="10" size="11" name="tgl_mulai" /> <span class="required">*</span>  <a href="javascript:calA.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a></td>     
        </tr>
        <tr>
         <td width="150">Tanggal Selesai:</td>
         <td><input type="text" maxlength="10" size="11" value="<?=$row[TglSelesai]?>" name="tgl_selesai" /> <span class="required">*</span>  <a href="javascript:calB.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"></a> </td>
        </tr>
        <tr>
         <td>Jumlah Cuti</td>
         <td>
         <select name="jumlah_cuti">
          <?
          	for($i=1;$i<=66;$i++){
				echo"<option value='$i'";
				if($i == $row[jml_cuti]){
					echo" selected";
				}
				echo">$i</option>";
			}
		  ?>
         </select>
         </td>
        </tr>
        <tr>
         <td valign="top">Keterangan:</td>
         <tD>
         <textarea cols="45" name="keterangan" rows="5"><?=$row[keterangan]?></textarea><span class="required">*</span> 
         </td>
        </tr>
     </table>
     </fieldset>
     </td>
	</tr>
   </table>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="right">
  <input type="hidden" name="cat" value="cuti_besar" />
  <input type="hidden" name="no" value="<?=$row[id]?>" />
  <input type="hidden" name="per_cb" value="<?=$per_cb?>" />
  <input type="button" value="Batal" class="button" onclick="Javascript:history.back();" />
  <input type="button" value="<?=$Vbutton?>" class="button" onclick="Javascript:ValBesar();" />
  </td>
 </tr>
</table>
</td>
</tr>
</form>
<?
}
?>
</table>
</body>
<script type="text/javascript">
/*
var f = document.forms[0];
MaskInput(f.tgl_mulai,"99/99/9999");
MaskInput(f.tgl_selesai,"99/99/9999");
MaskInput(f.tgl_hangus,"99/99/9999");
MaskInput(f.jumlah_cuti,"999");
/*
var CB = document.forms['CB'];
MaskInput(CB.tgl_mulai,"99/99/9999");
MaskInput(CB.tgl_selesai,"99/99/9999");
MaskInput(CB.tgl_hangus,"99/99/9999");
MaskInput(CB.jumlah_cuti,"999");
*/

//MaskInput(f.jumlah_cuti,"999");
//]]>
</script>

<script type="text/javascript">
// script untuk popup calendar
<?
	if($show == "cuti_tahunan"){
		for($k=1;$k<=12;$k++){
			echo"
				var cal$k = new calendar1(document.forms[0].elements['tgl_mulai$k']);
				cal$k.year_scroll = true;
				cal$k.time_comp = false;
				
				var f = document.forms[0];
				MaskInput(f.tgl_mulai$k,\"99/99/9999\");
	
			";
		}
	}
	elseif($show == "cuti_khusus"){
		//for($k=1;$k<=12;$k++){
			echo"
				var f = document.forms[0];
				MaskInput(f.tgl_mulai,\"99/99/9999\");
				MaskInput(f.tgl_selesai,\"99/99/9999\");
				
				var calA = new calendar1(document.forms[0].elements['tgl_mulai']);
				calA.year_scroll = true;
				calA.time_comp = false;	
			
				var calB = new calendar1(document.forms[0].elements['tgl_selesai']);
				calB.year_scroll = true;
				calB.time_comp = false;	
			";
		//}
	}
	elseif($show == "cuti_besar"){
		//for($k=1;$k<=12;$k++){
			echo"
				var f = document.forms[0];
				MaskInput(f.tgl_mulai,\"99/99/9999\");
				MaskInput(f.tgl_selesai,\"99/99/9999\");
				
				var calA = new calendar1(document.forms[0].elements['tgl_mulai']);
				calA.year_scroll = true;
				calA.time_comp = false;	
			
				var calB = new calendar1(document.forms[0].elements['tgl_selesai']);
				calB.year_scroll = true;
				calB.time_comp = false;	
			";
		//}
	}
	elseif($show == "cuti_tahunan_ed"){
		//for($k=1;$k<=1;$k++){
			echo"
				var cal = new calendar1(document.forms[0].elements['tgl_mulai']);
				cal.year_scroll = true;
				cal.time_comp = false;
				
				var f = document.forms[0];
				MaskInput(f.tgl_mulai,\"99/99/9999\");
	
			";
		//}
	}
	else{
?>		
	var calA = new calendar1(document.forms[0].elements['tgl_mulai']);
	calA.year_scroll = true;
	calA.time_comp = false;	

	var calB = new calendar1(document.forms[0].elements['tgl_selesai']);
	calB.year_scroll = true;
	calB.time_comp = false;	
<?
	}
?>
</script>
<?
echo"</div>
	  </td>
	   </tr>
	    </table>
";
include("../menu.php");
?>
